package com.esri.core.internal.tasks.ags;

import com.esri.core.internal.tasks.TaskListener;
import com.esri.core.io.EsriServiceException;
import com.esri.core.io.UserCredentials;
import com.esri.core.map.FeatureEditResult;
import java.util.HashMap;
import org.codehaus.jackson.JsonParser;
import org.codehaus.jackson.JsonToken;

/* loaded from: classes.dex */
public class f extends com.esri.core.internal.tasks.d<FeatureEditResult> {
    private static final long serialVersionUID = 1;

    public f(g gVar, String str, UserCredentials userCredentials, TaskListener<FeatureEditResult> taskListener) {
        super(gVar, str, userCredentials, taskListener);
    }

    public f(g gVar, String str, UserCredentials userCredentials) {
        super(gVar, str, userCredentials);
    }

    @Override // com.esri.core.internal.tasks.a
    /* renamed from: a */
    public FeatureEditResult execute() throws Exception {
        com.esri.core.internal.io.handler.j jVar;
        g gVar = (g) this.actionInput;
        HashMap hashMap = new HashMap();
        hashMap.put("attachmentId", Long.valueOf(gVar.b()));
        if (gVar.g() != null) {
            hashMap.put("gdbVersion", gVar.g());
        }
        if (gVar.c() != null) {
            jVar = new com.esri.core.internal.io.handler.j(gVar.c(), "attachment", gVar.e(), hashMap);
        } else {
            jVar = new com.esri.core.internal.io.handler.j(gVar.d(), gVar.f(), "attachment", gVar.e(), hashMap);
        }
        JsonParser a = com.esri.core.internal.io.handler.h.a(this.serviceURL + '/' + gVar.a() + "/updateAttachment", jVar, 1, getServiceCredentials());
        FeatureEditResult featureEditResult = null;
        if (!com.esri.core.internal.util.d.c(a)) {
            throw new EsriServiceException("Unable to parse the Update Attachement result response.");
        }
        while (a.nextToken() != JsonToken.END_OBJECT) {
            String currentName = a.getCurrentName();
            a.nextToken();
            if ("updateAttachmentResult".equals(currentName)) {
                featureEditResult = FeatureEditResult.fromJson(a);
            } else {
                a.skipChildren();
            }
        }
        a.close();
        return featureEditResult;
    }
}
